package com.sunpy.niohttp.model;

import java.util.ArrayList;
import java.util.List;

/**
 * 函数基本信息
 */
public class MethodInfo {
    /**
     * 包名
     */
    private String packageName;

    /**
     * 类名
     */
    private String clazzName;

    /**
     * 方法名
     */
    private String methodName;

    private List<AnnotationInfo> annotationInfoList = new ArrayList<>();

    /**
     * 方法参数对象集合
     */
    private List<ParamInfo> paramInfoList = new ArrayList<>();

    /**
     * 方法参数默认值集合
     */
    List<Object> paramValues = new ArrayList<>();

    /**
     * 方法参数类型集合
     */
    List<Class<?>> paramTypes = new ArrayList<>();

    /**
     * 全路径方法名，内部用 | 隔开
     */
    private String fullMethodName;

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public String getClazzName() {
        return clazzName;
    }

    public void setClazzName(String clazzName) {
        this.clazzName = clazzName;
    }

    public String getPackageName() {
        return packageName;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    public String getFullMethodName() {
        return fullMethodName;
    }

    public void setFullMethodName(String fullMethodName) {
        this.fullMethodName = fullMethodName;
    }

    public List<ParamInfo> getParamInfoList() {
        return paramInfoList;
    }

    public void setParamInfoList(List<ParamInfo> paramInfoList) {
        this.paramInfoList = paramInfoList;
    }

    public List<Object> getParamValues() {
        return paramValues;
    }

    public void setParamValues(List<Object> paramValues) {
        this.paramValues = paramValues;
    }

    public List<Class<?>> getParamTypes() {
        return paramTypes;
    }

    public void setParamTypes(List<Class<?>> paramTypes) {
        this.paramTypes = paramTypes;
    }

    public List<AnnotationInfo> getAnnotationInfoList() {
        return annotationInfoList;
    }

    public void setAnnotationInfoList(List<AnnotationInfo> annotationInfoList) {
        this.annotationInfoList = annotationInfoList;
    }

    /**
     * 生成全路径方法名
     */
    public void generateFullMethod() {
        StringBuilder sb = new StringBuilder();
        sb.append(packageName);
        sb.append("|");
        sb.append(clazzName);
        sb.append("|");
        sb.append(methodName);
        setFullMethodName(sb.toString());
    }

    @Override
    public String toString() {
        return "MethodInfo{" +
                "packageName='" + packageName + '\'' +
                ", clazzName='" + clazzName + '\'' +
                ", methodName='" + methodName + '\'' +
                ", annotationInfoList=" + annotationInfoList +
                ", paramInfoList=" + paramInfoList +
                ", paramValues=" + paramValues +
                ", paramTypes=" + paramTypes +
                ", fullMethodName='" + fullMethodName + '\'' +
                '}';
    }
}
